import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class CustomDialog {
  static Future<bool?> showDialog({
    required BuildContext ctx,
    required String info,
    void Function()? onConfirm,
    void Function()? onCancel,
    required String confirmText,
    required String cancelText,
  }) async {
    var result = await showCupertinoDialog<bool>(
      context: ctx,
      barrierDismissible: false,
      builder: (context) {
        return CupertinoAlertDialog(
          title: Text(info),
          actions: [
            if (onConfirm != null)
              CupertinoDialogAction(
                onPressed: onConfirm,
                child: Text(confirmText),
              ),
            if (onCancel != null)
              CupertinoDialogAction(
                isDestructiveAction: true,
                onPressed: onCancel,
                child: Text(cancelText),
              ),
          ],
        );
      },
    );
    return result;
  }
}
